package com.zzx.controller;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.zzx.model.Book;
import com.zzx.service.BookService;

@RestController
@RequestMapping("book")
public class BookController {

	@Resource
	private BookService bookService;
	
	
	@GetMapping("all")
	@ResponseBody
	public Book findAll() {
		try {
			return bookService.findAll();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
	
	@RequestMapping("insert")
	@ResponseBody
	public Book insert(@RequestParam("aaa") Book book) {
		try {
			return bookService.findAll();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
	
	@RequestMapping("update")
	@ResponseBody
	public Book update(@RequestParam("aaa") Book book) {
		try {
			return bookService.findAll();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
}
